<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>慢慢买列表</title>
    <link rel="stylesheet" href="./css/base.css">
    <link rel="stylesheet" href="./css/index.css">
</head>
<body>
        <header>
                <a class="return" href="javascript:;">
                    <!-- <span class="icon-left"></span> -->
                    <div></div>
                    <!-- <img src="./images/返回 (1).png" alt=""> -->
                </a>
                <span class="header-title">
                    国内折扣
                </span>
                 <a class="download" href="javascript:;">
                     <img src="./images/header_app.png" alt="">
                 </a>
        </header>
        <div class="comments">
                     <a href="javascript:;">
                        <h6>西域美农新疆特产五星和田红枣250g*2</h6>
                        <span class="com-span">19.8元(五件99元)</span>
                        <span>京东商城</span>
                        <span>10-22 13:28</span>
                        <span>chenjin/慢慢买</span>
                        <p>原价25.9元一斤,凑满五件只需99元1价格。枣子紧实,入口甜爽,适合公司人多的买吧,价格还是不错的。</p>
                        <img src="./images/hong.jpg" alt="">
                    </a>
        </div>
        <div class="button">
            <span>前往购买</span>
        </div>
</body>
</html>
<script src="./lib/template.js"></script>
<script src="./js/jquery.min.js"></script>
<script src="./js/utils.js"></script>
<script id="commentsTemplate" type="text/template">
{{each result as val key}}
    <a href="javascript:;">
       <h6>{{val.productName}}</h6>
       <span>{{val.productPrice}}</span>
       <span class="com-span">{{val.productPrice}}</span>
       <span>{{val.productFrom}}</span>
       <span>{{val.productTime}}</span>
       <span>{{val.productTips}}</span>
       <p>{{val.productInfo}}</p>
       {{val.productImg}}
   </a> 
{{/each}}
</script> 
 <script>
     var productId=URLHandle.parameter(location.search).productid;
    //  console.log(productId);

    $.ajax({
        type:"get",
        url:"http://193.112.55.79:9090/api/getdiscountproduct",
        data:{
            productid :productId
        },
        dataType:"json",
        success:function(res){
        console.log(res);
        template.config("escape", false)
        var str = template("commentsTemplate",res);
        $(".comments").html(str);
        }
    });
</script>